home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 22 / Amiga Format AFCD22 (Jan 1998, Issue 106).iso / -seriously_amiga- / shareware / programming / other / a68kenh / near.asm < prev   
Assembly Source File  |  1997-11-05  |  847b  |  58 lines

  1. ; This file assumes that the '-m0' option is used on the command line
  2. ;
  3. ;
  4. ;
  5.     SECTION    CODE
  6. ;
  7. ;    Superfluous at start of program (Makes program easier to read?)
  8. ;
  9.     FAR
  10. ;
  11. ;    Easy to code but generates longer, slower instructions
  12. ;
  13.     MOVE.L    eins,D0
  14.     SUB.L    zwei,D0
  15.     ADD.L    drei,D0
  16. ;
  17. ;    Set register to point at start of data section
  18. ;
  19.     LEA    DataStart,A4
  20. ;
  21. ;    Lots of typing but generates shorter, faster instructions
  22. ;
  23.     MOVE.L    eins-DataStart(A4),D0
  24.     SUB.L    zwei-DataStart(A4),D0
  25.     ADD.L    drei-DataStart(A4),D0
  26. ;
  27. ;    Nifty directive
  28. ;
  29.     NEAR    A4        ; 'A4' is default - coded for clarity
  30. ;
  31. ;    Now that 'NEAR' is active, the '-DataStart(A4)' is no longer needed
  32. ;
  33.     MOVE.L    eins,D0
  34.     SUB.L    zwei,D0
  35.     ADD.L    drei,D0
  36. ;
  37. ;
  38. ;
  39.     RTS
  40. ;
  41. ;    Only one data section can be declared if 'NEAR' is to be used
  42. ;
  43.     SECTION    data
  44. ;
  45. ;
  46. ;
  47. DataStart
  48. ;
  49. ;
  50. ;
  51. eins    dc.l    1
  52. zwei    dc.l    2
  53. drei    dc.l    3
  54. ;
  55. ;
  56. ;
  57.     end
  58.